// test

if( hq == undefined ) {
	var hq = {};
}

hq.layout = {
	
	init : function() {
		console.group( 'layout::init' );
		$j('#cshadowl').remove();
		$j('#cshadowr').remove();
		$j('#footer').remove();
	//	$j('#contentwrap').width('100%');
	//	$j(window).resize( toolbox.delegate( hq.layout.resize, hq.layout ) );
		//hq.layout.resize();
		
		console.groupEnd();
	},
	
	resize : function() {

		console.group( 'layout::resize' );		
		
		var $map = $j( '#mapWrapper' );
		var $pane = $j( '#contentWrapper' );
		
		var height = $j( document).height();
		//$j('DIV.idx_wrapper').outerHeight();
		var heighttemp = 0;//$j('#footer').height();
		//if(heighttemp<10||heighttemp>300) {heighttemp=50}
		heighttemp = heighttemp + $j( '#idx_wrapper' ).offset()['top'];
		height = $j( window ).height()- heighttemp;
		$map.height( height + 'px' );
		$pane.height( height + 'px' );
		$pane.trigger( 'resize' );
		

		$map.trigger( 'resize' );
		
		var width = $pane.outerWidth();
		if(width<100 || width> 500) { width=311; }
		$pane.width( width + 'px' );
		
		var widthtemp = $j( '#idx_wrapper' ).outerWidth();
		
		if(widthtemp==0)
		{widthtemp = $j('#header').outerWidth();}
		width = widthtemp - width - 1 ; // -1 added to account for the 1px border
		
		
		
		$map.width( width + 'px' );
		

		$pane.trigger( 'resize' );
		

		$map.trigger( 'resize' );
		
		
		console.groupEnd();		

	}
	
};

$j( document ).ready( toolbox.delegateNPA( hq.layout.init, hq.layout ) );
